package com.srlg.common.util;

import com.srlg.common.util.fun.ThrowExceptionFunction;

/**
 * @author : srlg li
 * @date :2022/4/15 0:00
 */
public class ExceptionUtil {

    /**
     * 如果参数为true抛出异常
     * @param exp 表达式
     * @return ThrowExceptionFunction
     */
    public static ThrowExceptionFunction isTrue(boolean exp) {

        return (em) -> {
            if (exp) {
                throw new RuntimeException(em);
            }
        };
    }
}
